/**
 * Created with JetBrains PhpStorm.
 * User: Artem
 * Date: 04.03.13
 * Time: 22:40
 * To change this template use File | Settings | File Templates.
 */

Ext.define("Pro.view.ConsolePanel", {
    extend: "Ext.Panel",
    alias: "widget.consolepanel",
    title: localization.CONSOLE_PANEL_TITLE || "Console",
    region: "south",
    height: 300,
    collapsed: true,
    split: true,
    collapsible: true,
    layout: "border",
    items: [
        {
            xtype: "tabpanel",
            width: 400,
            region: "east",
            split: true,
            items: [
                {
                    xtype: "textarea",
                    title: localization.CONSOLE_PANEL_REQUEST_TAB || "Request",
                    id: "request",
                    readOnly: true
                },
                {
                    xtype: "textarea",
                    title: localization.CONSOLE_PANEL_RESPOND_TAD || "Respond",
                    id: "respond",
                    readOnly: true
                }
            ]
        },
        {
            xtype: "panel",
            layout: {
                type: "hbox",
                align: "stretch"
            },
            region: "center",
            id: "contPanel",
            items: [
                {
                    xtype: "panel",
                    title: localization.CONSOLE_PANEL_EVENT_LOG_TITLE || "Event log",
                    layout: "fit",
                    id: "eventLogPanel",
                    flex: 1,
                    items: [
                        {
                            xtype: "textarea",
                            id: "eventLogArea",
                            readOnly: true
                        }
                    ],
                    bbar: [
                        "->",
                        {
                            xtype: "button",
                            text: localization.CONSOLE_PANEL_EVET_LOG_BUTTON_CLEAR_HISTORY || "Clear history",
                            id: "clearHistoryButton"
                        }
                    ]
                },
                {
                    xtype: "panel",
                    layout: {
                        type: "hbox",
                        align: "stretch"
                    },
                    title: localization.CONSOLE_PANEL_SQL_TITLE || "SQL Console",
                    id: "sqlPanel",
                    flex: 3,
                    items: [
                        {
                            xtype: "panel",
                            flex: 2,
                            id: "sqlResultGridPanel",
                            layout: "fit"
                        },
                        {
                            xtype: "form",
                            flex: 1,
                            layout: "fit",
                            id: "sqlFormPanel",
                            items: [
                                {
                                    xtype: "textarea",
                                    name: "sql"
                                }
                            ],
                            bbar: [
                                "->",
                                {
                                    xtype: "button",
                                    text: localization.CONSOLE_PANEL_SQL_BUTTON_EXECUTE || "Execute",
                                    id: "executeButton"
                                }
                            ]
                        }
                    ]
                }
            ],
            bbar: [
                {
                    xtype: "button",
                    text: localization.CONSOLE_PANEL_BUTTON_EVENT_LOG || "Event log",
                    id: "eventLogButton",
                    enableToggle: true,
                    pressed: true
                },
                {
                    xtype: "button",
                    text: localization.CONSOLE_PANEL_BUTTON_SQL_CONSOLE || "SQL Console",
                    id: "sqlConsoleButton",
                    enableToggle: true,
                    pressed: true
                },
                "->",
                {
                    xtype: "button",
                    text: localization.CONSOLE_PANEL_BUTTON_UPDATE_SERVER_DATA || "Update server data",
                    id: "updateServerDataButton"
                }
            ]
        }
    ]
});